/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 殇
 * Date: 2025-05-20
 * Time: 11:41
 */
//只出现唯一一次的数
public class code4 {
    public static int onlyNum(int[] nums){
        int ret=0;
        for(int x:nums)
            ret^=x;
        return ret;
    }
    public static void main(String[] args) {
        int[] nums1=new int[]{2,2,1};
        int[] nums2=new int[]{4,1,2,1,2};
        System.out.println(onlyNum(nums1));
        System.out.println(onlyNum(nums2));
    }
}
